
#pragma once

#include "vec.h"
#include "matrix.h"
#include "model.h"

class RenderPacket;

namespace Blox
{
	class Canvas
	{
	public:
		static inline void SetDefaultCanvas ( Canvas * pCanvas ) { m_pDefault = pCanvas; }
		static void LoadDefaultModels ( );

	public:
		Canvas ( ) { }

		virtual ~Canvas ( ) { Clean(); }

		virtual bool Init ( void * pData ) =0;

		virtual void Clean ( ) { }

		virtual void Render ( RenderPacket const & rPacket ) =0;

		virtual void DrawTri ( Blox::Vec const & v0, Blox::Vec const & v1, Blox::Vec const & v2, u32 c0, u32 c1, u32 c2 ) { }

		virtual void DrawLine ( Blox::Vec const & v0, Blox::Vec const & v1, u32 c0, u32 c1 ) { }

		void DrawLine ( Blox::Vec const & v0, Blox::Vec const & v1, u32 c0 )
		{
			DrawLine(v0,v1,c0,c0);
		}

		void DrawTri ( Blox::Vec const & v0, Blox::Vec const & v1, Blox::Vec const & v2, u32 c0 )
		{
			DrawTri(v0,v1,v2,c0,c0,c0);
		}

		void Draw ( AABB const & rAABB, u32 const uCol, float fScale = 1.0f );

	public:
		static Canvas * m_pDefault;
		static Model * m_pModelCube;
	};

}
